//
//  puzzleCharacter.m
//  NCMM
//
//  Created by McCallie, Cameron D (Genworth) on 10/11/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "PuzzleCharacter.h"


@implementation PuzzleCharacter
@synthesize myLabel;
@synthesize myXCoord;
@synthesize myYCoord;
@synthesize index;
@synthesize overlay;


- (id)initWithLabel:(NSString*)label andFrame:(CGRect)frame andDelegate:(id) delegate
{
    self = [super initWithFrame:frame];
    myDelegate = delegate;
    [self setBackgroundImage:[UIImage imageNamed:@"square.png"] forState:UIControlStateNormal];
    [self setTitle:label forState:UIControlStateNormal];
    [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    

    
    return self;
}

- (void)buttonAction
{
    [self setBackgroundImage:[UIImage imageNamed:@"squareyellow.png"] forState:UIControlStateNormal];
//    //CASE 1 = both disabled
//    if (primary == NO && secondary == NO)
//    {
//        [self setBackgroundImage:[UIImage imageNamed:@"selectedSquare.png"] forState:UIControlStateNormal];
//        primary = YES;
//    }
//           
//    //CASE 2 = primary enabled, primary gets clicked again and thus disabled
//    if (primary == YES && secondary == NO)
//    {
//        if (self.backgroundImage == [UIImage imageNamed:"selectedSquare.png"])
//        {
//            [self setBackGroundImage:[UIImage imageNamed:@"square.png"] forState:UIControlStateNormal];
//            primary = NO;
//        }
//    }
//     
//    //CASE 3 = primary enabled, another button gets pressed
//    else if (self.backgroundImage == [UIImage imageNamed"square.png"])
//    {
//        [self setBackGroundImage:[UIImage imageNamed:@"selectedSquare.png"] forState:UIControlStateNormal];
//        secondary = YES;
//    }
//    else
//        NSLog(@"Son, you got problems in 'buttonAction'");
}


- (void)dealloc
{
    [super dealloc];
}

@end
